package chapter_8;

import java.util.HashSet;
import java.util.Iterator;

public class Test9 {
    public static void main(String[] args) {
        HashSet<String> set = new HashSet<>();
        set.add(new String("aa"));
        set.add(new String("aa"));
        set.add(new String("aa"));
        set.add(new String("aa"));
        set.add(null);
        set.add(null);
        for (String s : set) {
            System.out.println(s);
        }
        Iterator<String> iterator = set.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}
